"""Definition of the iknow content type
"""

from zope.interface import implements

from Products.Archetypes import atapi
from Products.ATContentTypes.content import base
from Products.ATContentTypes.content import schemata

# -*- Message Factory Imported Here -*-
from my315ok.xtinfocontent import xtinfocontentMessageFactory as _

from my315ok.xtinfocontent.interfaces import Iiknow
from my315ok.xtinfocontent.config import PROJECTNAME

iknowSchema = schemata.ATContentTypeSchema.copy() + atapi.Schema((

    # -*- Your Archetypes field definitions here ... -*-

    atapi.TextField(
        'question',
        storage=atapi.AnnotationStorage(),
        widget=atapi.RichWidget(
            label=_(u"question"),
            description=_(u""),
        ),
    ),


    atapi.StringField(
        'category',
        storage=atapi.AnnotationStorage(),
        widget=atapi.StringWidget(
            label=_(u"question category"),
            description=_(u""),
        ),
    ),


    atapi.StringField(
        'publisher',
        storage=atapi.AnnotationStorage(),
        widget=atapi.StringWidget(
            label=_(u"publisher"),
            description=_(u""),
        ),
        required=True,
    ),


))

# Set storage on fields copied from ATContentTypeSchema, making sure
# they work well with the python bridge properties.

iknowSchema['title'].storage = atapi.AnnotationStorage()
iknowSchema['description'].storage = atapi.AnnotationStorage()

schemata.finalizeATCTSchema(iknowSchema, moveDiscussion=False)


class iknow(base.ATCTContent):
    """a answer question content type"""
    implements(Iiknow)

    meta_type = "iknow"
    schema = iknowSchema
    _at_rename_after_creation = True

    title = atapi.ATFieldProperty('title')
    description = atapi.ATFieldProperty('description')

    # -*- Your ATSchema to Python Property Bridges Here ... -*-
    question = atapi.ATFieldProperty('question')

    category = atapi.ATFieldProperty('category')

    publisher = atapi.ATFieldProperty('publisher')


atapi.registerType(iknow, PROJECTNAME)
